<?php 
define('_VIEW_MODEL_','admin');
session_start();
$statu = $_SESSION['statu'];
require_once("../init.php");
if(!$statu){
	echo "<script>window.parent.location.href='./index.php'</script>";
}
if(isset($page)){
		$page = intval($page);
	}else{
		$page = 1;
	}
if(isset($act)&&$act=="upda"){
	$id = intval($id);
	$va = intval($val);
	$ti = time();
	
	$db->Execute("update {$telper}mail set isread='1' where id = $id");
	$array = $db->GetRow("select `from`,`fromname` from {$telper}mail where id=$id");
	$db->Execute("insert {$telper}mail set `from`='0',fromname='管理员',`for`='$array[from]',forname='$array[fromname]',title='你好,$array[fromname]',cont='你的申请已经在处理中',time='$ti'");
}
$stat = ($page-1)*$adminusernum;
$num  = $db->GetRow("select count(id) from {$telper}mail where `for`='1'");
$rs = $db->Execute("select * from {$telper}mail where `for`='1' order by state asc,time desc");
if(!empty($rs)){
	$info = $rs->GetArray();
}else{
	$info = false;
}
$pageObj = new Page($num['count(id)'],$adminusernum,$smartyObj);
$smartyObj->assign('title',$admintitle);
$smartyObj->assign('info',$info);
$smartyObj->assign('adminbbstitle',$adminaplay);
$smartyObj->display("adminaplay.tpl");
?>